package org.ace.logic.user.dto;

import org.ace.basicdata.model.PlayerBasicData;
import org.ace.constans.GameConstans;
import org.ace.dao.model.Player;
import org.ace.model.DressEquipment;
import org.ace.serializer.MySqlSerializer;

/*
 * 角色数据传输模型
 * */
public class PlayerDTO {
	/**
     * 玩家角色id
     */
    public Integer userid;

    /**
     * 账号id
     */
    public Integer id;

    /**
     * 角色昵称
     */
    public String username;

    /**
     * 角色职业
     */
    public Integer userjob;

    /**
     * 色角等级
     */
    public Integer lv;

    /**
     * 角色所在地图
     */
    public Integer map;

    /**
     * 角色地图x坐标
     */
    public Float x;

    /**
     * 角色地图Y坐标
     */
    public Float y;

    /**
     * 角色地图z坐标
     */
    public Float z;

    /**
     * 当前角色经验
     */
    public Integer exp;

    /**
     * 当前攻击力
     */
    public Integer atk;

    /**
     * 当前防御力
     */
    public Integer def;

    /**
     * 当前Hp
     */
    public Integer hp;

    /**
     * 当前法力值
     */
    public Integer mp;

    /**
     * 最大法力值
     */
    public Integer mpmax;

    /**
     * 最大生命值
     */
    public Integer hpmax;

    /**
     * 角色金币
     */
    public Integer money;

    /**
     * 角色体力值
     */
    public Integer energy;

    /**
     * 色角元宝
     */
    public Integer gold;
    
    /**
     * 角色穿戴装备
     * */
    public DressEquipmentDTO equipment;
   
    
    public PlayerDTO(Player player)
    {
    	this.userid=player.getUserid();
    	this.username=player.getUsername();
    	this.id =player.getId();
    	this.userjob = player.getUserjob();
    	this.atk = player.getAtk();
    	this.def = player.getDef();
    	this.hp = player.getHp();
    	this.hpmax = player.getHpmax();
    	this.lv = player.getLv();
    	this.exp = player.getExp();
    	this.mp= player.getMp();
    	this.mpmax =player.getMpmax();
    	this.money = player.getMoney();
    	this.map = player.getMap();
    	this.x= player.getX();
    	this.y= player.getY();
    	this.z= player.getZ();
    	this.energy = player.getEnergy();
    	this.gold = player.getGold();
    	//将玩家的装备存储的数据由二进制 转化为 装备 实体类对象
    	//这个实体不是数据库实体，而是装备类实体,也就是说数据库没有装备数据表。 
    	DressEquipment de=(DressEquipment) MySqlSerializer.deserialize(player.getEquipment());
    	
    	this.equipment =new DressEquipmentDTO(de);
    }
}
